home *** CD-ROM | disk | FTP | other *** search
- Path: druid.borland.com!usenet
- From: pete@borland.com (Pete Becker)
- Newsgroups: comp.lang.c++
- Subject: Re: static members of a class template
- Date: 26 Mar 1996 20:45:33 GMT
- Organization: Borland International
- Message-ID: <4j9l1d$gnm@druid.borland.com>
- References: <315781CB.2DD1@digex.net> <4j99ts$num@piper.logicon.com>
- NNTP-Posting-Host: pbecker.borland.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=ISO-8859-1
- X-Newsreader: WinVN 0.99.5
-
- In article <4j99ts$num@piper.logicon.com>, kkolda@logicon.com says...
- >
- >In article <315781CB.2DD1@digex.net>, yami@digex.net says...
- >>
- >>Hi,
- >>
- >>How would you go about declaring a static member of a class template?
- >>Example:
- >>
- >>template<class kind>
- >>class simple {
- >> private:
- >> static kind someVar;
- >>};
- >>
- >>simple<kind> kind simple::someVar;
- >>
- >>
- >>This seems to follow the general pattern for defining and declaring a
- >>static member, but it results in a syntax error. What's the problem?
- >>
- >>Thanks in advance for any advice!
- >>
- >>-Steve-
- >
- >
- >I think what you want is as follows:
- >
- >template simple<class kind> kind simple<kind>::someVar;
- >
- >where you could also add initialization info if desired.
-
- Please don't make things up. Look at real code, or try it with a compiler.
-
- template <class kind> kind simple<kind>::someVar;
-
-